/*
 * Copyright 2010 Alessandro Bellucci
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.soupframework.gwt.designerpanel.client.interaction;

import org.soupframework.gwt.designerpanel.client.designer.ContainerDesigner;
import org.soupframework.gwt.designerpanel.client.designer.Designer;

public interface InteractionHandlerManager<T> {

	/**
	 * Gets the root {@link Designer} for interactions
	 *
	 * @return the root {@link Designer}
	 */
	public Designer<T> getRootDesigner();

	/**
	 * Gets the {@link InteractionHandler} for the given {@link Designer}
	 *
	 * @param designer The {@link Designer}
	 * @return the {@link InteractionHandler}
	 */
	public InteractionHandler<T> getInteractionHandler(Designer<T> designer);

	/**
	 * Disable interactions with the {@link Designer}
	 */
	public void disableInteraction();

	/**
	 * Enable interactions with the {@link Designer}
	 */
	public void enableInteraction();

	/**
	 * Returns true if interactions with the {@link Designer} are enabled
	 *
	 * @return true if interactions are enabled
	 */
	public boolean isInteractionEnabled();


	/**
	 * Gets the {@link InteractionMode} of interaction handlers
	 *
	 * @return The interaction mode
	 */
	public InteractionMode getInteractionMode();

	/**
	 * Sets the {@link InteractionMode} for interaction handlers
	 *
	 * @param interactionMode The interaction mode
	 */
	public void setInteractionMode(InteractionMode interactionMode);

	/**
	 * Returns the root {@link ContainerDesigner} for selected widgets.
	 * If there is no selection or if selection has no common root, returns null
	 *
	 * @return the root {@link ContainerDesigner} for selection or null if no root for selection exists
	 */
	public ContainerDesigner<T> getSelectionRootDesigner();

	/**
	 * Gets the handler for the addition of new objects
	 *
	 * @return The {@link NewObjectsHandler}
	 */
	public NewObjectsHandler<T> getNewObjectsHandler();

	/**
	 * Sets the handler for the addition of new objects
	 *
	 * @param newObjectsHandler The {@link NewObjectsHandler}
	 */
	public void setNewWidgetsHandler(NewObjectsHandler<T> newObjectsHandler);

	/**
	 * Gets the resize mode
	 *
	 * @return The resize mode
	 */
	public ResizeMode getResizeMode();

	/**
	 * Sets the resize mode
	 *
	 * @param resizeMode The resize mode
	 */
	public void setResizeMode(ResizeMode resizeMode);

	/**
	 * Gets the object for the resize operation
	 *
	 * @return the object for the resize operation
	 */
	public T getResizingObject();

	/**
	 * Sets the object for the resize operation
	 *
	 * @param resizingObject the object to be resized
	 */
	public void setResizingObject(T resizingObject);
}
